package com.zwj.batch.core.batch.step.writer;

import com.zwj.batch.domain.po.UserPO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * @author 张文接
 * @version 1.0
 * @createTime 2023-06-26 11:12:00
 */
@Slf4j
@Component
public class UserWriter implements ItemWriter<UserPO> {

    @Override
    public void write(List<? extends UserPO> list) throws Exception {
        if (!CollectionUtils.isEmpty(list)) list.forEach(
                user -> log.info(user.toString())
        );
    }
}
